package hexagon;

/**
 *
 * @author Colin Bundervoet
 */
public abstract class HexagonField<T>
{
    HexagonTile<T>[][] field;
    //public final boolean hasHorizontalShift;
    public final boolean firstSeriesIsShorter;
    int xPos;
    int yPos;

    public HexagonField(boolean firstSeriesIsShorter, int xSize, int ySize)
    {
        field = new HexagonTile[xSize][ySize];
        this.firstSeriesIsShorter = firstSeriesIsShorter;
        xPos = -1;
        yPos = -1;
    }

    public HexagonTile<T> getTile(int x, int y)
    {
        return field[x][y];
    }

    public HexagonTile<T> get()
    {
        return field[xPos][yPos];
    }
    
    public void select(int x, int y)
    {
        xPos = x;
        yPos = y;
    }

    public boolean canMoveNorth()
    {
        return false;
    }
    
    public boolean canMoveSouth()
    {
        return false;
    }
    
    public boolean canMoveEast()
    {
        return false;
    }
    
    public boolean canMoveWest()
    {
        return false;
    }

    public void moveNorth()
    {

        throw new ImpossibleMoveException();

    }

    public void moveSouth()
    {

        throw new ImpossibleMoveException();
    }

    public void moveEast()
    {

        throw new ImpossibleMoveException();

    }

    public void moveWest()
    {
        throw new ImpossibleMoveException();
    }

    public abstract void moveNorthEast();
    public abstract void moveNorthWest();
    public abstract void moveSouthEast();
    public abstract void moveSouthWest();
    
    public boolean isAvailable(int x, int y)
    {
        return field[x][y].isAvailable();
    }
}
